package com.yootk;
import java.io.*;

public class YootkDemo {
    public static void main(String[] args) throws Exception {
        File file = new File("D:" + File.separator + "muyan" + File.separator + "vip" + File.separator + "yootk.txt");

        // 创建父目录（如果不存在）
        if (!file.getParentFile().exists()) {
            file.getParentFile().mkdirs();
        }

        // 使用 try-with-resources 自动关闭资源，避免资源泄漏
        try (Writer out = new FileWriter(file)) {
            out.write("沐言科技 : www.yootk.com\n");
            out.append("李兴华高薪就业编程训练营 : edu.yootk.com");
            out.flush();
            System.out.println("文件写入成功！");
        } catch (IOException e) {
            System.err.println("文件写入失败: " + e.getMessage());
            e.printStackTrace();
        }
    }
}